package com.springboot.film.service;

import com.springboot.film.dao.filmsDao;
import com.springboot.film.entity.films;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class filmsService {

    @Autowired
    private filmsDao filmsDao;

    /**
     * 显示总数量
     * @return
     */
    public int getCount() {
        return filmsDao.getCount();
    }

    /**
     * 全部分页显示
     * @return
     */
    public List<films> findByPage(int pos, int size) {
        return filmsDao.findByPage(pos, size);
    }

    /**
     * 显示搜索的总数量
     * @return
     */
    public int getsearchCount(String key,String name) {
        return filmsDao.getsearchCount(key,name);
    }

    /**
     * 搜索并分页显示
     * @return
     */
    public List<films> findsearchByPage(String key,String name,int pos, int size) {
        return filmsDao.findsearchByPage(key,name,pos, size);
    }

    /**
     * 添加
     * @param
     */
    public void add(films films) {
        filmsDao.add(films);
    }

    /**
     * 删除
     * @param id
     */
    public void delete(int id) {
        filmsDao.delete(id);
    }

    /**
     * 修改(先找到并显示，再修改)
     * @param
     */
    public List<films> getUserone(int id) {
        return filmsDao.getUserone(id);
    }
    public void update(films films) {
        filmsDao.update(films);
    }

    /**
     * 前台操作
     * @param
     */
    public List<films> getallhotfilms() {
        return filmsDao.getallhotfilms();
    }
    public List<films> getalltimefilms() {
        return filmsDao.getalltimefilms();
    }
    public int gettypeCount(String type) {
        return filmsDao.gettypeCount(type);
    }
    public int getviplookCount(int vip_look) {
        return filmsDao.getviplookCount(vip_look);
    }
    public int getallCount(String type,int vip_look) {
        return filmsDao.getallCount(type,vip_look);
    }
    public int getallsearchCount(String keyword) {
        return filmsDao.getallsearchCount(keyword);
    }
    public List<films> findtypeByPage(String type,int pos, int size) {
        return filmsDao.findtypeByPage(type,pos,size);
    }
    public List<films> findviplookByPage(int vip_look,int pos, int size) {
        return filmsDao.findviplookByPage(vip_look,pos,size);
    }
    public List<films> findallByPage(String type,int vip_look,int pos, int size) {
        return filmsDao.findallByPage(type,vip_look,pos,size);
    }
    public List<films> getmyfilms(int id,int fid) {
        return filmsDao.getmyfilms(id,fid);
    }
    public List<films> getallsearch(String keyword,int pos,int size) {
        return filmsDao.getallsearch(keyword,pos,size);
    }

    /**
     * 个性推荐算法
     * @param
     */
    public String gettype(int id) {
        return filmsDao.gettype(id);
    }
    public String getcontent(int id) {
        return filmsDao.getcontent(id);
    }
    public int getmaxid(String type) {
        return filmsDao.getmaxid(type);
    }
    public int getid(String type,int pos) {
        return filmsDao.getid(type,pos);
    }
    public List<films> getmylike(int id) {
        return filmsDao.getmylike(id);
    }

    public void updatehot(int id) {
        filmsDao.updatehot(id);
    }

    public List<films> getmyfilmsall(int uid) {
        return filmsDao.getmyfilmsall(uid);
    }

}
